import axios from '../utils/http'

const MenuStore = {
    namespaced: true,
    state: () => ({
        menu_list: []

    }),
    mutations: {
        MuenMutations(state,old){
            state.menu_list = old
            console.log(state.menu_list,'11111111');
        }
    },
    actions: {
        MenuActions(context){
            axios.get('/menulist?istree=1').then(
                res=>{
                    
                    if(res.code == 403){
                        localStorage.removeItem('log_list')
                        window.location.href = "/#/login"
                       
                    }else{
                        if(res.code == 200){
                            context.commit('MuenMutations',res.list)
                        }
                    }
                    
                }
            )
        }
    }
}
export default MenuStore